package com.huixiaodian.ft_user.manage;

import android.annotation.SuppressLint;
import android.content.Context;

import com.huixiaodian.baselibrary.retrofit.RetrofitClient;
import com.huixiaodian.ft_user.service.LoginService;

public class APIManager {

    private Context context;

    private LoginService loginService;

    @SuppressLint("StaticFieldLeak")
    private static APIManager apiManager;

    private APIManager(Context context){
        this.context = context;
    }

    public static APIManager getInstance(Context context){
        if(apiManager == null){
            synchronized (APIManager.class){
                if(apiManager == null)
                    apiManager = new APIManager(context);
            }
        }
        return apiManager;
    }

    public LoginService getLoginService(){
        if(loginService == null){
            loginService = RetrofitClient.getRetrofitClient(context).create(LoginService.class);
        }
       return loginService;
    }
}
